﻿using BW.MesProject.Public.ErrorCode;
using BW.MesProject.WareHouse.Domain;
using BW.MesProject.WareHouse.Infrastructure;
using BW.MesProject.WareHouse.Infrastructure.Dto.Input;
using BW.MesProject.WareHouse.Infrastructure.Dto.OutPut;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BW.MesProject.WareHouse.Host.Controllers
{

    /// <summary>
    /// 人员
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class EMPController : ControllerBase
    {
        // GET: api/<EMPController>
        private readonly IEMPServices EmpServices;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="EmpServices"></param>
        public EMPController(IEMPServices EmpServices)
        {
            this.EmpServices = EmpServices;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<int> AddEMP(EMPModel model)
        {
            return EmpServices.AddEMP(model);
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<List<EMPOut>> GetEMP([FromQuery] QryInput qryInput)
        {
            return EmpServices.GetEMPNew(qryInput);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<int> UpdatEMP(EMPModel model)
        {
            return EmpServices.UpdateEMP(model);
        }

        /// <summary>
        /// 修改启用
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPut]
        public ApiResult<int> UpdateEnable(EMPModel model)
        {
            return EmpServices.UpdateEnable(model);
        }


        /// <summary>
        /// 软删除
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpDelete]
        public ApiResult<int> UpdateDelete(string Id)
        {
            return EmpServices.UpdateDelete(Id);
        }

        /// <summary>
        /// 查询编码
        /// </summary>
        /// <param name="EMPId"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<int> GetEMPId(string EMPId)
        {
            return EmpServices.GetEMPID(EMPId);
        }
    }
}
